// compile: g++ -o explicit explicit.cc -std=c++11
// run: ./explicit
#include <iostream>

using namespace std;

class Int1 {
 public:
  Int1(int data) : data_(data) {}
  Int1& operator=(const Int1&) = delete;
  int data_;
};
class Int2 {
 public:
  explicit Int2(int data) : data_(data) {}
  int data_;
};
void Test1() {
  Int1 a = 1;  // 1转换为一个Int1类型临时对象，再通过默认生成的拷贝构造函数构造a
  // Int2 b = 1; 编译出错，explicit禁止隐式转换
}
void Test2() {}
int main() {
  Test1();
  Test2();
  return 0;
}
